package com.maikang.exammall.util.validator;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class NotBlankOrNullValidator implements ConstraintValidator<NotBlankOrNull, Object> {

    @Override
    public void initialize(NotBlankOrNull notBlankOrNull) {
    }

    @Override
    public boolean isValid(Object o, ConstraintValidatorContext constraintValidatorContext) {
        if (o == null) return true;
        return o.toString().trim().length() != 0;
    }
}
